//
//  HS_DetailFooterCollectionReusableView.m
//  悦享
//
//  Created by 韩双 on 16/3/17.
//  Copyright © 2016年 张洪国. All rights reserved.
//

#import "HS_DetailFooterCollectionReusableView.h"
#import <UIImageView+WebCache.h>

@interface HS_DetailFooterCollectionReusableView ()

@property (nonatomic, retain) UIView *dataView;     /**< 底部view */
@property (nonatomic, retain) UIImageView *userImage;   /**< 用户头像 */
@property (nonatomic, retain) UILabel *nameLable;  /**< 用户名 */
@property (nonatomic, retain) UILabel *titleLable;    /**< title */
@property (nonatomic, retain) UILabel *conmentLable;   /**< text */

@end

@implementation HS_DetailFooterCollectionReusableView

- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    
    if (self) {
        
        [self createSubviews];
    }
    return self;
}
// 初始化
- (void)createSubviews {
    
    self.dataView = [[UIView alloc] init];
    [self addSubview:_dataView];
    
    self.userImage = [[UIImageView alloc] init];
    [_dataView addSubview:_userImage];
    
    self.nameLable = [[UILabel alloc] init];
    [_dataView addSubview:_nameLable];
    
    self.titleLable = [[UILabel alloc] init];
    [_dataView addSubview:_titleLable];
    
    self.conmentLable = [[UILabel alloc] init];
    [_dataView addSubview:_conmentLable];

    
}

- (void)setModel:(HS_commentModel *)model {
    
    _model = model;
    
    [self assignment];
    
    
}

// 赋值
- (void)assignment {
    
    _dataView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height - 10);
    _dataView.backgroundColor = [UIColor whiteColor];
    
    _userImage.frame = CGRectMake(10, 10, 30, 30);
    _userImage.layer.cornerRadius = 15;
    _userImage.layer.masksToBounds = YES;
    [_userImage sd_setImageWithURL:[NSURL URLWithString:_model.user_profile_image_url] placeholderImage:[UIImage imageNamed:PLACE_HLODER]];
    
    _nameLable.frame = CGRectMake(50, 20, SREEN_WIDTH - 50, 20);
    _nameLable.font = [UIFont systemFontOfSize:15];
    _nameLable.text = _model.user_name;
    
    CGSize size = [APPTools labelRectWithSize:CGSizeMake(SREEN_WIDTH - 20, 0) LabelText:_model.text Font:[UIFont systemFontOfSize:17]];
    _titleLable.frame = CGRectMake(10, 50, size.width, size.height + 10);
    _titleLable.numberOfLines = 1000;
    _titleLable.text = _model.text;
    
}



@end
